package mylibrary.network.socket;

import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.sql.Timestamp;
import java.util.Date;

public class Server {

	public static void main(String[] args) throws Exception {
		
		ServerSocket ss = new ServerSocket(100);
		
		int i=0;
		while(true) {
			
			
			Socket socket = ss.accept();
			
			OutputStream os = socket.getOutputStream();

			i++;
			System.out.println("this i=" + i + " start " + new Timestamp(System.currentTimeMillis()));

			Thread thread = new Thread(new ExecutionThread(socket, os));
			
			thread.start();
			
			System.out.println("i=" + i + " end " + new Timestamp(System.currentTimeMillis()));
		}
	}
}
